import axios from '@/libs/axios1.js'
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' }

//获取docker运行环境
export const getAllDocker = (search) => {
  return axios({
    url: `/generation-image/template`,
    method: 'get',
    params:search,
    headers:jsonHeaders
  })
}

//添加脚本
export const addScripts = params => {
	return axios({
		url: `/checker/scripts`,
		method: 'post',
		data: params,
		headers: jsonHeaders
	})
}

//删除脚本
export const delScripts = params => {
	return axios({
		url: `/checker/scripts/${params}`,
		method: 'delete',
		headers: jsonHeaders
	})
}

//查询脚本详细信息
export const queryCheck = id => {
	return axios({
		url: `/checker/scripts?id=${id}`,
    method: 'get',
		headers: jsonHeaders
	})
}

// 获取参数字典
export const getDictionaries = params => {
  return axios({
    url: `/checker/dictionaries`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//靶标绑定脚本
export const bindingCheck = (id,scriptId) => {
    return axios({
        url: `/resource-manager/target/bindScript/${id}?scriptId=${scriptId}`,
        method: 'get',
        headers: jsonHeaders
    })
}

//主观题绑定脚本
export const bindingSub = (id,scriptId) => {
    return axios({
        url: `/new-paper/subjective/question/bindScript/${id}?scriptId=${scriptId}`,
        method: 'get',
        headers: jsonHeaders
    })
}

// 修改脚本
export const modifyScript = (id,params) => {
  return axios({
      url: `/checker/scripts/${id}`,
      method: 'put',
      data:params,
      headers: jsonHeaders,
  })
}

//靶标解绑脚本
export const unboundCheck = (scriptId) => {
  return axios({
      url: `/resource-manager/target/unbindScript/${scriptId}`,
      method: 'get',
      headers: jsonHeaders,
  })
}

//主观题解绑脚本
export const unboundSub = (scriptId) => {
  return axios({
      url: `/new-paper/subjective/question/unbindScript/${scriptId}`,
      method: 'get',
      headers: jsonHeaders,
  })
}

//查询成功或者失败的信息
export const getOperateInfo = (id,params) => {
  return axios({
    method: 'get',
    url: `/resource-manager/operate/${id}`,
    params: params,
    headers: jsonHeaders
  })
}